package com.forenow.demo.IOdemo;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        List<Student> list = new ArrayList<>();
        for(int i = 0;i<2;i++){
            System.out.println("请输入学生的编号：");
            String sid = input.next();
            System.out.println("请输入学生的姓名：");
            String name = input.next();
            System.out.println("请输入学生的年龄：");
            int age = input.nextInt();
            System.out.println("请输入学生的学校：");
            String school = input.next();
            //将用户的输入信息封装到对象中保存
            Student s = new Student();
            s.setId(sid);
            s.setName(name);
            s.setAge(age);
            s.setShcool(school);
            //将当前对象添加到list集合中
            list.add(s);
        }
        //调用Operator中的方法sava()
        Operator operator = new Operator();
        operator.save(list,"Student.txt");

    }
}
